package com.springapp.mvc.dao;

import com.springapp.mvc.model.Admin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;

/**
 * User: yzh
 * Date: 11/6/15
 * Time: 10:05
 */
public class AdminDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    public List<Admin> query(String userName, String userPw) {
        String sql = "select * from  t_admin where userName = ? and userPw = ?;";
        List<Admin> result = jdbcTemplate.query(sql, new Object[]{userName, userPw}, new BeanPropertyRowMapper(Admin.class));
        return result;
    }
}
